package com.mis.pos.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.mis.pos.base.entity.BaseEntity;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

/**
 * @description: 系统权限
 * @author: yuxiang
 * @create: 2019-12-12 15:43
 **/
@Entity
@Table(name = "sys_permission")
public class SysPermission extends BaseEntity {

    /**
     *名称
     */
    private String name;
    /**
     * 描述
     */
    private String description;
    /**
     * 权限url
     */
    private String url;
    @JsonIgnoreProperties(value = {"permissions"}) //指定的字段不会被序列化
    @ManyToMany
    @JoinTable(name = "SysRolePermission",joinColumns = {@JoinColumn(name = "permissionId")}, inverseJoinColumns = {@JoinColumn(name = "roleId")})
    private List<SysRole> roles;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<SysRole> getRoles() {
        return roles;
    }

    public void setRoles(List<SysRole> roles) {
        this.roles = roles;
    }
}
